package bcxd.firstline.supplier.machining;

import java.sql.Connection;
import java.util.Map;

import org.limp.basework.MachiningException;
import org.limp.basework.SimpleBean;
import org.limp.basework.SimpleBeanMachining;
import org.limp.basework.Table;
import org.limp.basework.impl.CommonBean4HSQ;
import org.limp.mine.DateTrimmer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PersonalApplyInfoMachining implements SimpleBeanMachining {

	private static final Logger LOG = LoggerFactory
			.getLogger(PersonalApplyInfoMachining.class);

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public SimpleBean machining(SimpleBean bean, Table table,
			CommonBean4HSQ request, Connection conn, int type)
			throws MachiningException {

		LOG.debug("type={}", type);

		if (type == -4) {
			String status = "0";

			Map apply = bean.getResource();
			apply.put("sup_audit_status", status);
			apply.put("sup_apply_date", DateTrimmer.getYMDHMS());

			// SimpleBean4Table user = new SimpleBean4TableImpl("BCXD_USER");
			// user.getResource().put("uname", apply.get("sup_name"));
			// user.getResource().put("logid", RandomUtil.getRandomString(10));
			// user.getResource().put("pwd",
			// EncryptTool.encryptString("000000"));
			// user.getResource().put("utype", "personal-supplier");
			// user.getResource().put("ustatus", status);

			try {
				// new BaseworkUtil().manualSave1(user, conn);
			} catch (Exception e) {
				throw new MachiningException("create supplier user error.", e);
			}
		}
		return null;
	}

}